moved session db code into class