Backport tornado 3.0 implementation