Can't figure out what's causing the problem with my remove funciton