cleaned AoE code