Cleaning up code, adding comments and deleting old stuff