Merged all seperate modules to one file and optimized the code