Refactor FractalRule and unit tests

Refactored FractalRule and added unit tests.