Changed checkSession to a private method.