improved display function

Faster cycle through codes