split the implementation of function to new .c files