Found out the meaning of the "A" flag and updated the code