Add more test coverage

Adds more tests and cleans up unused functions.