work towards table of contents, now with buggy debug output, not working at all as intended.