refactor, add cr.h, cr.c