Allow filename substitutions, support different modes