refactor session with class inherit