implementing the rules