can now specify output file and directory