Restructured code into seperate files.