added some TODO cleaned up some functions