refactoring in.h, out.h