use switch to go through FileMode cases