remove function implemented and tested