Updated with better route logic