finished refactor exercise