added duration option, error checking