Proper Session manager writter from scratch