cleaned up commented code, make sure unlink() never fails