abstract out reusable stuff to new BaseRenderer class