Fixed some rendering stuff, added double-buffering toggle. Going to try changing rendering to OpenGL in next commit.