added retrieving gateway from route string function