code refactoring : no using global variation, at least in function