Improving handling of file types (needed for #5)