added source code of gateway