Change structure of gateways, project refactoring