Implemented solve and tests