remove redundancy in render loop