diff --git a/Dockerfile b/Dockerfile
index 054704a..e73fcce 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:14.04
+FROM ubuntu:16.04
 
 MAINTAINER TuRzAm
 
@@ -17,16 +17,24 @@ ENV NBPLAYERS 70
 ENV UPDATEONSTART 1
 # if the server is backup when start with docker start
 ENV BACKUPONSTART 1
-#  branch on github for ark server tools
-ENV BRANCH master
+#  Tag on github for ark server tools
+ENV GIT_TAG v1.6.56
 # Server PORT (you can't remap with docker, it doesn't work)
 ENV SERVERPORT 27015
 # Steam port (you can't remap with docker, it doesn't work)
 ENV STEAMPORT 7778
+# if the server should backup after stopping
+ENV BACKUPONSTOP 0
+# If the server warn the players before stopping
+ENV WARNONSTOP 0
+# UID of the user steam
+ENV UID 1000
+# GID of the user steam
+ENV GID 1000
 
 # Install dependencies 
 RUN apt-get update &&\ 
-    apt-get install -y curl lib32gcc1 lsof git
+    apt-get install -y curl lib32gcc1 lsof git sudo
 
 # Enable passwordless sudo for users under the "sudo" group
 RUN sed -i.bkp -e \
@@ -44,15 +52,20 @@ RUN usermod -a -G sudo steam
 
 # Copy & rights to folders
 COPY run.sh /home/steam/run.sh
+COPY user.sh /home/steam/user.sh
 COPY crontab /home/steam/crontab
 COPY arkmanager-user.cfg /home/steam/arkmanager.cfg
 
+RUN touch /root/.bash_profile
 RUN chmod 777 /home/steam/run.sh
+RUN chmod 777 /home/steam/user.sh
 RUN mkdir  /ark
 
 
 # We use the git method, because api github has a limit ;)
-RUN  git clone -b $BRANCH https://github.com/FezVrasta/ark-server-tools.git /home/steam/ark-server-tools
+RUN  git clone https://github.com/FezVrasta/ark-server-tools.git /home/steam/ark-server-tools
+WORKDIR /home/steam/ark-server-tools/
+RUN  git checkout $GIT_TAG 
 # Install 
 WORKDIR /home/steam/ark-server-tools/tools
 RUN chmod +x install.sh 
@@ -61,12 +74,15 @@ RUN ./install.sh steam
 # Allow crontab to call arkmanager
 RUN ln -s /usr/local/bin/arkmanager /usr/bin/arkmanager
 
-# Define default config file in /ark
+# Define default config file in /etc/arkmanager
 COPY arkmanager-system.cfg /etc/arkmanager/arkmanager.cfg
 
+# Define default config file in /etc/arkmanager
+COPY instance.cfg /etc/arkmanager/instances/main.cfg
+
 RUN chown steam -R /ark && chmod 755 -R /ark
 
-USER steam 
+#USER steam 
 
 # download steamcmd
 RUN mkdir /home/steam/steamcmd &&\ 
@@ -75,9 +91,12 @@ RUN mkdir /home/steam/steamcmd &&\
 
 
 # First run is on anonymous to download the app
-RUN /home/steam/steamcmd/steamcmd.sh +login anonymous +quit
+# We can't download from docker hub anymore -_-
+#RUN /home/steam/steamcmd/steamcmd.sh +login anonymous +quit
 
 EXPOSE ${STEAMPORT} 32330 ${SERVERPORT}
+# Add UDP
+EXPOSE ${STEAMPORT}/udp ${SERVERPORT}/udp
 
 VOLUME  /ark 
 
@@ -85,4 +104,4 @@ VOLUME  /ark
 WORKDIR /ark
 
 # Update game launch the game.
-ENTRYPOINT ["/home/steam/run.sh"]
+ENTRYPOINT ["/home/steam/user.sh"]
diff --git a/README.md b/README.md
index 8aabce0..79dc045 100644
--- a/README.md
+++ b/README.md
@@ -59,9 +59,9 @@ You can easily configure automatic update and backup.
 If you edit the file `/my/path/to/ark/crontab` you can add your crontab job.  
 For example :  
 `# Update the server every hours`  
-`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1`    
+`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2>&1`    
 `# Backup the server each day at 00:00  `  
-`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1`  
+`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2>&1`  
 *You can check [this website](http://www.unix.com/man-page/linux/5/crontab/) for more information on cron.*
 
 To add mods, you only need to change the variable ark_GameModIds in *arkmanager.cfg* with a list of your modIds (like this  `ark_GameModIds="987654321,1234568"`). If UPDATEONSTART is enable, just restart your docker or use `docker exec ark arkmanager update --update-mods`.
@@ -75,8 +75,8 @@ To add mods, you only need to change the variable ark_GameModIds in *arkmanager.
 - Edit */my/path/to/ark/GameUserSetting.ini and Game.ini*
 - Edit */my/path/to/ark/arkserver.cfg* to add mods and configure warning time.
 - Add auto update every day and autobackup by editing */my/path/to/ark/crontab* with this lines :  
-`0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1`  
-`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1`  
+`0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2>&1`  
+`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2>&1`  
 - `docker start ark`
 - Check your server with :  
  `docker exec ark arkmanager status` 
@@ -100,8 +100,16 @@ Steam server port (can't rebind with docker, it doesn't work) (default : 7778)
 1 : Backup the server when the container is started. 0: no backup (default : 1)
 + __UPDATEPONSTART__
 1 : Update the server when the container is started. 0: no update (default : 1)  
++ __BACKUPONSTOP__
+1 : Backup the server when the container is stopped. 0: no backup (default : 0)
++ __WARNONSTOP__
+1 : Warn the players before the container is stopped. 0: no warning (default : 0)  
 + __TZ__
 Time Zone : Set the container timezone (for crontab). (You can get your timezone posix format with the command `tzselect`. For example, France is "Europe/Paris").
++ __UID__
+UID of the user used. Owner of the volume /ark
++ __GID__
+GID of the user used. Owner of the volume /ark
 
 
 --- 
@@ -118,6 +126,7 @@ Time Zone : Set the container timezone (for crontab). (You can get your timezone
     + /ark/template : Default config files
     + /ark/template/arkmanager.cfg : default config file for Ark Server Tools
     + /ark/template/crontab : default config file for crontab
+    + /ark/staging : default directory if you use the --downloadonly option when updating.
 
 --- 
 
@@ -146,4 +155,13 @@ Time Zone : Set the container timezone (for crontab). (You can get your timezone
   - You can now config crontab with the file /your/ark/path/crontab
   - Add template directory with default config files.
   - Add documentation on TZ variable.
++ 1.3 :
+  - Add BACKUPONSTOP to backup the server when you stop the server (thanks to [fkoester](https://github.com/fkoester))
+  - Add WARNONSTOP to add warning message when you stop the server (default: 60 min)
+  - Works with Ark Server Tools v1.5
+    - Compressing backups so they take up less space
+    - Downloading updates to a staging directory before applying
+    - Added support for automatically updating on restart
+    - Show a spinner when updating
+  - Add UID & GID to set the uid & gid of the user used in the container (and permissions on the volume /ark)
 
diff --git a/arkmanager-system.cfg b/arkmanager-system.cfg
index ab328d1..b15199a 100644
--- a/arkmanager-system.cfg
+++ b/arkmanager-system.cfg
@@ -17,6 +17,7 @@ arkserverroot="/ark/server"                                         # path of yo
 arkserverexec="ShooterGame/Binaries/Linux/ShooterGameServer"        # name of ARK server executable
 arkbackupdir="/ark/backup"  		                            # path to backup directory
 arkautorestartfile="ShooterGame/Saved/.autorestart"                 # path to autorestart file
+arkStagingDir="/ark/staging"  
 
 # config Service
 servicename="arkserv"                                               # Name of the service (don't change if you don't know what are you doing)
@@ -30,5 +31,14 @@ ark_RCONPort="32330"                                                # RCON Port
 
 # steamdb specific
 appid=376030                                                        # Linux server App ID
+mod_appid=346110                                                    # App ID for mods
+
+# Need to be true to work with UPDATEPONSTART (See #10)
+arkAutoUpdateOnStart="true"                                        # set this to true if you want to always update before startup
+
+defaultinstance="main"
+
+# We don't use the dots because it doesn't show.
+progressDisplayType=spinner
 
 source /ark/arkmanager.cfg
diff --git a/arkmanager-user.cfg b/arkmanager-user.cfg
index a972ff4..f5d3ff2 100644
--- a/arkmanager-user.cfg
+++ b/arkmanager-user.cfg
@@ -3,6 +3,8 @@
 # comment out these values if you want to define them
 # inside your GameUserSettings.ini file
 serverMap=${SERVERMAP}                                          # server map (default TheIsland)
+#serverMapModId="469987622"                                         # Uncomment this to specify the Map Mod Id (<fileid> in http://steamcommunity.com/sharedfiles/filedetails/?id=<fileid>)
+#ark_TotalConversionMod="496735411"                                 # Uncomment this to specify a total-conversion mod
 ark_SessionName=${SESSIONNAME}                                  # if your session name needs special characters please use the .ini instead
 ark_ServerPassword=${SERVERPASSWORD}                            # ARK server password, empty: no password required to login
 ark_ServerAdminPassword=${ADMINPASSWORD}                        # ARK server admin password, KEEP IT SAFE!
@@ -26,10 +28,22 @@ mod_branch=Windows
 # ARK server options - i.e. for -optname=val, use arkopt_optname=val
 #arkopt_StructureDestructionTag=DestroySwampSnowStructures
 
+#ark_AltSaveDirectoryName="SotF"                                    # Uncomment to specify a different save directory name
 
 # Update warning messages
 # Modify as desired, putting the %d replacement operator where the number belongs
 msgWarnUpdateMinutes="This ARK server will shutdown for an update in %d minutes"
 msgWarnUpdateSeconds="This ARK server will shutdown for an update in %d seconds"
+msgWarnRestartMinutes="This ARK server will shutdown for a restart in %d minutes"
+msgWarnRestartSeconds="This ARK server will shutdown for a restart in %d seconds"
+msgWarnShutdownMinutes="This ARK server will shutdown in %d minutes"
+msgWarnShutdownSeconds="This ARK server will shutdown in %d seconds"
+
+# config environment
+arkwarnminutes="60"                                                 # number of minutes to warn players when using update --warn
 arkBackupPreUpdate="false"                                          # set this to true if you want to perform a backup before updating
-arkwarnminutes="30" 						    # number of minutes to warn players when using update --warn
+
+# Options to automatically remove old backups to keep backup size in check
+# Each compressed backup is generally about 1-2MB in size.
+arkMaxBackupSizeMB="500"                                            # Set to automatically remove old backups when size exceeds this limit
+#arkMaxBackupSizeGB="2"                                             # Uncomment this and comment the above to specify the limit in whole GB
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..71126e9
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,21 @@
+ark:
+  container_name: ark
+  image: turzam/ark
+  environment:
+    - SESSIONNAME=Ark Docker
+    - SERVERMAP=TheIsland
+    - SERVERPASSWORD="" 
+    - ADMINPASSWORD=adminpassword
+    - BACKUPONSTART=1
+    - UPDATEONSTART=1
+    - TZ=Europe/Paris
+    - GID=1000
+    - UID=1000
+  volumes:
+    - /my/path/to/ark:/ark
+  ports:
+   - 7778:7778/udp
+   - 7778:7778
+   - 27015:27015/udp
+   - 27015:27015
+   - 32330:32330
diff --git a/instance.cfg b/instance.cfg
new file mode 100644
index 0000000..1585d84
--- /dev/null
+++ b/instance.cfg
@@ -0,0 +1,2 @@
+# Config root directory
+arkserverroot="/ark/server"
diff --git a/run.sh b/run.sh
index fbe2fe6..80fff6b 100644
--- a/run.sh
+++ b/run.sh
@@ -1,16 +1,27 @@
 #!/usr/bin/env bash
 echo "###########################################################################"
 echo "# Ark Server - " `date`
+echo "# UID $UID - GID $GID"
 echo "###########################################################################"
 [ -p /tmp/FIFO ] && rm /tmp/FIFO
 mkfifo /tmp/FIFO
 
 export TERM=linux
 
-if [ ! -w /ark ]; then 
-	echo "[Error] Can't access ark directory. Check permissions on your mapped directory with /ark"
-	exit 1
-fi
+function stop {
+	if [ ${BACKUPONSTOP} -eq 1 ] && [ "$(ls -A server/ShooterGame/Saved/SavedArks)" ]; then
+		echo "[Backup on stop]"
+		arkmanager backup
+	fi
+	if [ ${WARNONSTOP} -eq 1 ];then 
+	    arkmanager stop --warn
+	else
+	    arkmanager stop
+	fi
+	exit
+}
+
+
 
 # Change working directory to /ark to allow relative path
 cd /ark
@@ -24,28 +35,30 @@ cp /home/steam/crontab /ark/template/crontab
 [ ! -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/arkmanager.cfg
 [ ! -d /ark/log ] && mkdir /ark/log
 [ ! -d /ark/backup ] && mkdir /ark/backup
-[ ! -f /ark/Game.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/Game.ini Game.ini
-[ ! -f /ark/GameUserSettings.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini GameUserSettings.ini
+[ ! -d /ark/staging ] && mkdir /ark/staging
+[ ! -L /ark/Game.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/Game.ini Game.ini
+[ ! -L /ark/GameUserSettings.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini GameUserSettings.ini
+[ ! -f /ark/crontab ] && cp /ark/template/crontab /ark/crontab
 
 
 
-if [ ! -d "/ark/server"  ] || [ ! -f "/ark/server/arkversion" ];then 
+if [ ! -d /ark/server  ] || [ ! -f /ark/server/version.txt ];then 
+	echo "No game files found. Installing..."
+	mkdir -p /ark/server/ShooterGame/Saved/SavedArks
+	mkdir -p /ark/server/ShooterGame/Content/Mods
+	mkdir -p /ark/server/ShooterGame/Binaries/Linux/
+	touch /ark/server/ShooterGame/Binaries/Linux/ShooterGameServer
 	arkmanager install
 	# Create mod dir
-	mkdir /ark/server/ShooterGame/Content/Mods
 else
 
-	if [ ${BACKUPONSTART} -eq 1 ]; then 
+	if [ ${BACKUPONSTART} -eq 1 ] && [ "$(ls -A server/ShooterGame/Saved/SavedArks/)" ]; then 
 		echo "[Backup]"
 		arkmanager backup
 	fi
-
-	if [ ${UPDATEONSTART} -eq 1 ]; then 
-		echo "[Update]"
-		arkmanager update --update-mods
-	fi
 fi
 
+
 # If there is uncommented line in the file
 CRONNUMBER=`grep -v "^#" /ark/crontab | wc -l`
 if [ $CRONNUMBER -gt 0 ]; then
@@ -59,13 +72,17 @@ else
 fi
 
 # Launching ark server
-arkmanager start
+if [ $UPDATEONSTART -eq 0 ]; then
+	arkmanager start -noautoupdate
+else
+	arkmanager start
+fi
 
 
 # Stop server in case of signal INT or TERM
 echo "Waiting..."
-trap 'arkmanager stop;' INT
-trap 'arkmanager stop' TERM
+trap stop INT
+trap stop TERM
 
 read < /tmp/FIFO &
 wait
diff --git a/user.sh b/user.sh
new file mode 100644
index 0000000..a49bdfc
--- /dev/null
+++ b/user.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Change the UID if needed
+if [ ! "$(id -u steam)" -eq "$UID" ]; then 
+	echo "Changing steam uid to $UID."
+	usermod -o -u "$UID" steam ; 
+fi
+# Change gid if needed
+if [ ! "$(id -g steam)" -eq "$GID" ]; then 
+	echo "Changing steam gid to $GID."
+	groupmod -o -g "$GID" steam ; 
+fi
+
+# Put steam owner of directories (if the uid changed, then it's needed)
+chown -R steam:steam /ark /home/steam
+
+# avoid error message when su -p (we need to read the /root/.bash_rc )
+chmod -R 777 /root/
+
+# Launch run.sh with user steam (-p allow to keep env variables)
+su -p - steam -c /home/steam/run.sh