Fix matcher issues and add missing comments.
Minimize duplication in the Solver class.