improved design: callback function outside of ui but shared memory with ui (does not use base_ui.iterate anymore).