Code cleanup as well as better commenting system