Adding logic to conditionally set clientstorage