Remove unused imports.
Add ability to specify dir and env. Fixes #4 and fixes #5.