handled edge cases, and validation of hte equation.