lots and lots of debugging corrections...