Added third $filename param for non-persistent filenames