reduce ugliness of delete function