Added functions to Gateway.py