Refactors to allow for much faster testing.