Tidied code: Fixed typeos & changed logging to only occur on test gateway.