light refactoring and generalization
slimify