add session support and refactor the db tables