reorganized static functions into common.h