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

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