wrote WriteMode routine and replaced code in Passive.c with it