add more debug output
get rid of crappy multi dimensional array, use struct chain instead