Fixing up deduction, foundation codes and tags