move the code in a header file