Refactoring some code for more readability.