Fixed a bunch of fundamental bugs, and then some rendering stuff