[Rendering] Refactored some Rendering code;