Move solve functionality into separate fuction.