prevent repeating of render fn

take call to render out of loop