Better filename detection.
To address issue #11, expose the rule direction.