Updated remove method

Checked if element exists in list before removing it, to avoid "node not found" error