Moved session cleanup to where it will actually be called