Can you also add some documentation here? This is a very complicated thing!