First version of solver