modified update_config function to allow for changing the routing function