replaced streams with own implementation for testing (issue #2)
fixes #2 with version reusing more standard Java classes