This method is pretty weird. It should probably also be IDisposable.