updated unit tests and cleaned up a bit