routing logic and sample