Significant refactoring using ClassyPrelude.