trying to improve remove-allocated