Sidestream sorta-cherry pick from @lmartinho's improvement branch
Hopefully fixes #87