changed the action to be based on a case statement which depends on the router type