Calculations and flags in the script