Refactored branch working ok for all functions and tools