refactors the refactoring as it wasn't quite there the first time.