Router code clean up