Refactoring of renderer