added support for custom filenames