changed if_file to be a function instead of property