refactorings: style, generalization and using applicative where it can help readability