Refactored part 2