added support for overwrite option