Refactored cookie usage