started building solve function