updated render function