Output details of fourth rule violations

Fixed what appeared to be a bug that was preventing proper logging of the details of fourth rule violations. Refactored the code in that section a bit. Added a couple of tests for fourth rule violation logging.