Moved installation check to the top of the script