Add detailed middleware comments