revise comparison and extend to work around periphery of display

revise comparison and extend to work around periphery of display