updated solve() function