Add forgotten call of chmod(2)
Move common 'clear_cell' code to function.