Fixed loop in display code