Made some changes to the A2 function