move function body to cpp