Organizing the code slightly better and adding more robust parameter declarations. Also, adding support for rule variations.