Added context middleware support