implement remove method with index parameter