updated to use file module