Changed display style and made it less prone to runtime error