More bug fixes on helper functions
Update of the databaseSectorScript

to work on the comprehensive database and keep track of processed and
not-yet-processed MSA.