Refactoring some function names and some cleanups.