Some unused function cleanup.
Some refactoring.