Improve test support and singleton scope