Tidied up the session checker.