refactor codes with classes
set and read secure cookie