options can be a function

I came into a situation where too many possible options are needed that it can not be fit into an array. With this change, if the options is a function, it gets called, so there is no need to generate the array beforehand.

I've tried the demo page, it is still functioning well.