improved tests, using context manager everywhere