moved learner function out