working refactored renderer