debug in progress
a bunch of fixes and cleanup to logging and calculations