finished a lot of TODO's, testing left to be done