Cleaning up code, added some comments