move functions out of headers.