updated file with solve function