Week 6 homework - misc corrections and refactorings.