Simple on demand choice logic

I tried revising my solution, found a few problems, and then came up with this... It has the advantage of simplicity, but it does sometimes add more explicit function settings to the db than really necessary.