Refactoring to make code cleaner.