Simplify gateway logic, increase coverage