added some debugging output, some docs and some todos