Added middleware component as per discussions