move functions to cpp