removed unused code, cleaned up some more code