moved code from header files to cpp files