Made the display() function more safe by making sure the given parameter is not empty