Minor clean up of code removing unneeded variables and some unnecessary code