ticket:3 middleware implemented