Re-write the restart required checks

My guiding idea was double.

1. we can't make assumptions as to the previous state of the functions in a category, 
2. when importing, first you delete, then you set, and we were checking restart at each stage, which means we were saying restart required when in the end nothing had been changed.