Refactored some code in the source file.