logic changed for pressing enter