Add middleware, add sample url, refine engine