Rearranged code in display() and update()