more pep8 and some refactor. added required output_dir option