wip: use contextmanagers instead of try-catches to handle common errors