kinda rewrite the gateway