Removed unneccesary code and added comments to everything