update_route_file happens in both cases, the difference only in last args. Could you please refactor to combine args, and execute update_route_file outside if/else statement.