Use function declaration for inner function in share modal