added halfdelay logic for display input