Implemented solver algorithm