Refacto by extracting rules