Automatically execute calculations in correct order