Fix rules generator
Refactor all models to new rules format