Big DRY refactor.  Less code == less problems.