added in some more tests, made some code more pythonic