Added some env script for an easier setup and various bug fixes.