Add AD and AP support

haven't test yet, just some ideas, maybe you should copy/fix and put them to right place