Refined the rule syntax,moved over to separate rule files and fixed some bugs.