Refactored effect rendering code.