Improving the code with a right CLOSURE