Added isAuthenticated middleware