Allow values based on number (@jsvk)

With lots of help from @jsvk.