first stab at ads

Do not merge yet,
For review only now
What is the purpose of this function?