Implement solve