More changes to the session check and efficiency