split common stuff to header file