Refactor dinamic_tools.py