added learning/testing code