imsfun.c added