revised logic