Changed solve() method