Simplify dict and minor fixes.