This function worked without declaring the global scope (!?)