Even more refactoring

Only 3 unit tests failing now!