i like the use of context managers here, very clean