Implemented core of solver