reworked schema, and updated code to use new session api