added comments for each middleware