2013-Dec-28: Homework from review, refactorings and cleanup