Testability refactor for flag generator's overlays (flagoverlays.js), including some utility functions to be shared betweeb overlays and divisions (flagutils.js)