"origin: function" fixes and enhancements

PR #12 introduced a bug for the case that options.orign is a function.