Added tests for rule positioning and referenced rules