Homework4 Middleware