Big updates to the graphics engine

Changed the API quite a bit.