Added some value checks and separated out the narrow solve algorithm into its own method.