learning curve plot; some refactoring