Removed unneeded includes, cleaned up code, added comments