moving function from header file to c file