refactoring to try and debug the havoc I have wrought...
More and more refactoring to try and debug this mess.