thanks @pelson yes is a lot neater within a context manager