Added more tests and cleaned up a bit