CLeaned up code
Cleaned up more code, added comments