added more to the rerouting function