cleaned up some code