adds extra refactoring from ch 5 excercises