Use function instead of the global scope