partial refactoring of learning
removed some stuff; reorganization