Refactor U Week 8 exercise on unit testing