Refactored some more code.