Refactors architecture issues raised by @bmihelac