Added solve function, but haven't tried to run the code yet.