add unit tests; implement idisposable