remove render code redundancy