put updateTitle inside a closure

This avoids polluting global namespace