Refactor solver API and tests