Fixing issues and continuing module rewrite