Refactor exercises from chapter two