Replaced startsWith and endsWith with string.js library. Adapted unit tests to stream2 module. Generally improved code a little bit.