Change cell background colors and fix bugs when storing rules