snow: refactor code to work around a compiler bug in MSVC.