Added middleware for connect