This if -> else if section should be a private helper function.  Same logic is run below but with a different transport argument and no return value.