adding support for overwriting the file