Solve working.
Minor refactorings.