Move rules into separate module
Create more generic mechanism for rules