Added debug output to Renderer and various bugfixes