Use file_put_contents for simplicity and readbility
Remove unused code and spurious alert