added onRender function