Implement Dispose according to the spec. Ugghh so complicated.