clean up and added comments to all methods
fixed merge