Update middleware to use new session class.