updated to use user-specified filename