pre and next function in header file