Refactor session variable