Sessions in database
Added some tests for sessions
Security fixes