Added the beginning of mode function to io.c and io.h.