Improve rendering system, fix numerous bugs