Add an aadb function
Reorganize