refatoring the routing