fixed bugs in the debug renderer, also lots of cleanup