initial improvements to file mean code