More precise version of AMDF. Fixed endianity.