cleaning up code and adding comments to modules