AE method testing

First refactoring the stuff around, then writing the tests.