Made some critical changes in gates.py and some minor changes in Connector