Gateway changes for readability and reliability