Wait... This isn't Prolog! Use static vars instead of worker funcs.