Finally seems to work now. I still need more testing, and of course killing the debug codes, but it works fine on the test core and localhost.