Fixed up design to be nicer (d instead of debugln, etc)
Parameterize on whole stream, not just character type