refactored setupAE