Remove unused functions and add more test coverage

api change docs needed