outsourced the aS function from the simulation