add user session model, minor refactoring
Merge remote-tracking branch 'origin/master'