Removed module ID.

Probably not important.
Cleaned up code.
Moved cwd stuff to separate function.