Stream handling. Closes #143