added more tests. refactored some as well