ticket:3 middleware and stuff