Moved logic into compiler and renderer.