Rules files and master main function