add flash, refactor session to share functionality with flash via cookie class