Ok current state, not fully tested

new debug messages, and an overall rework of a bunch of stuff.