optimize remove method