Some refactoring for learnsets