Working version of dynamic rules parsing and sampling