clean up

removed some dubble stuff and added comments to a couple of functions