Removed unneeded code and added comments