refactoring attempt 1