Refactor to extract render