Adds better validation and calculation.