Reorganized rules file so it checks for devices by name before id.