quick refactor of renderer to split up loops - untested