Add sesssion support + refactoring