.refactoring : more elegant code