added code to switch routing