major refactor of renderer