adds some commentary and remove unnecessary code