Got cookie logic working