diff --git a/templates/build_icon.sh b/templates/build_icon.sh
index 5040844d2784b181103379d23d18553ba4a5853a..c8bc5c064d2277744d22fb984418f0ca98c79f4b 100644
--- a/templates/build_icon.sh
+++ b/templates/build_icon.sh
@@ -1,16 +1,37 @@
-# Get workdir from autosubmit
+# Get some variables provided by autosubmit.
+# TODO: What do we do to ensure that these variables are defined in the proj file?
 WORKDIR=%HPCROOTDIR%
+ICON_VERSION=%ICON_VERSION%
+SPACK_URL=%spack.url%
+SPACK_BRANCH=%spack.branch%
 
-# If folder does not exist create it
+
+# If the workdir directory does not exist create it
 if [ ! -d ${WORKDIR} ] ; then
         mkdir -p ${WORKDIR}
 fi
 
-# Go to working directory
+# Go to the working directory
 cd ${WORKDIR}
 
-git clone %spack.url% -b %spack.branch%
+# Check if experiment's spack installation already exists, if it doesn't, clone it.
+SPACK_ENV=spack/share/spack/setup-env.sh
+if [ ! -f ${SPACK_ENV}] ; then
+  git clone ${SPACK_URL} -b ${SPACK_BRANCH}
+  #TODO: Would be good to enable the re-utilization of existing spack packages (via packages.yaml or upstreams.yaml)
+fi
 
-source spack/share/spack/setup-env.sh
+# Setup the environment
+source ${SPACK_ENV}
 
-spack install icon-nwp@%icon_version%
+# If the model is not installed, install it.
+if [ $( spack find icon-nwp@${ICON_VERSION} &> /dev/null ; echo $? ) -ne 0 ]; then
+  spack install icon-nwp@${ICON_VERSION}
+fi
+
+if [ $( spack find icon-nwp@${ICON_VERSION} &> /dev/null ; echo $? ) -ne 0 ]; then
+        echo "Installing icon-nwp@${ICON_VERSION}."
+        spack install icon-nwp@${ICON_VERSION}
+else
+        echo "icon-nwp@${version} already installed!"
+fi