[*] Moved functions from global scope