Refactoring ImageGate, preparing for mustella tests