Refactor the directory structure of all gateways.