Added a parameter direction to predicate openStreams/5.
Corrected bug on updating weight vector when pcv is zero length.
Cleanup commented code.