Remove unused functions and add more test coverage

This should stay