Cleanup and migration to the newest riak_core aae code
Some more generalization.
Merge branch 'test' into dev