cleaned up some code, still work to do