refactored renderer to use command visitor