Code from popsels, rules and variables.