Fixed my rule checking to look like Bryan's and fixed a divided by zero error.