updated with done
refactor to allow directory to be passed as option, and test
flake8