Rendering is partially-functional; I have an idea to make this more efficient, will do later