Optimize removeItemOfType

It should now be around twice as fast as it used to be