Implement erase() method