implemented alternate learning method which may perform better once code is multithreaded