refactoring session stuffs