Refactoring made. Rules added.