Made rendering work a little more correctly