changed functionality of applydt to take an output file name