added better context, middleware