Refactoring 1st attempt