cleaned up learning code