Improve how pinned providers are handled

Moved to demobitmask.py