Added additional variables/calculations and conditional statement.