Clean up

Cleaned up code, added some more comments and organization