Including refactorings suggested in review.