Added new test and fixed existing tests. Added extra logic for creating a rule