move code from h to cpp file