implementation of RulesOf6005