takes basedir from cli
cleaned up style, thanks pep8!