encapsulating render methods into functions