adding solve function