Made the gateway a plugin, using more of the routing functionality