add debugging to the new goal management, and add logging of errors