adds some commentary and remove unecessary code