refactored source files

moved function definitions in the corresponding headers