Added comments, removed unneeded code