refactoring : simplify code