Extract some functions from render() methods