updated so that doperiodic flag is saved and time units