implemented new approach for modifing files