tweaks to the remove function