cookies added, additional logic added