Restructured code and started to modularise code