modified so that rundir can be specified via command line