Make the observer and on_close callbacks prettier