clean up code for merging into master