Jenjin 184

Enormous refactoring and test overhaul.