Implemented sessions
Fixed some session bugs