added overwrite flag