major update, lots of debugging stuff