Improve removal function