clean up and integration of session class - untested