adding middleware support.. step 1