added new functions for learning, everything now is in functions