Updated rendering function