simplified remove(int target) to use previously written functions, and changed return type to bool