move functions to header file.