Adding documentation and check for expired sessions