Fixed a nasty bug where the modules weren't concatted properly and did some refactoring