Replace existing file if exists
Better handling of extensions and make test pass again