supporting ending with a render function