Added comments and removed unneeded code