encapsulate router func