Add quit route and auto leave function