code cleanup
reformatted after merge