Some simple code refactoring.