Add cookie management
Added exception logging