Reworked ImGui delegate (it still lacks comments...)