refactoring assoc.c and assoc.h