refactor solver, sorter