added stream training ability
pulled upstream