Fixed contextmanager bug, cleaned up output, exceptions