mostly refactored to rules/reducers