Moved all rules to a rule registry located in scripts/registry.php

Also added Tests for correct working of the instance.php script