refactoring. Makes the code nicer and more compact.