Refactoring rules engine
cc
More generic rules handling
moved registry to api
Rules now only api, no impl