Added IDisposable and small fixes