Fixed rendering issue; lots of cleanup needed