Updated for ARM64 and better automation. Rewrote all the script.