Adding rules check. Need to refactor to avoid repetition