added utility functions and learning