add solve function