added support for multiple filenames and minor fixes