edited mode.c