Cleaned up code, added some comments