Refactoring almost done.
Refactoring nearly there.