Remove unused functions with some clarify refactoring.