Add some more test cases, address some issues, attempt to make test code more readable