From trees to loops and back