Added isValid function.
Removed isValid function and updated solve to handle the potential of an incomplete equation.