added rules
massive refactoring