Completed refactoring - fully functional.