changed remove method to removeElem