Added "file exists" check