Move boilerplate to func.