FILE WRITING WITH LEAF DELETING WORKING