Other changes

Removed lots of redundant code and added some comments