cleaned up some of the source code