This module was split out from main.js to facilitate testing.