Seperated out the display element function, fixed a bug that caused elements to not display properly