Fixed #3433. Using get_bin_path, removed uneeded imports, "module" is inlined, misc other style improvements.