diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index 1201e28009fcc8cfa83d956d55614ed312ca3ae9..4c8bc74c2cd57c3c7f5cc187ff451a102fff7d0d 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -1,15 +1,11 @@
 #!/bin/bash
-
-# Build MariaDB .deb packages.
-# Based on OurDelta .deb packaging scripts, which are in turn based on Debian
-# MySQL packages.
+#
+# Build MariaDB .deb packages for test and release at mariadb.org
+#
 
 # Exit immediately on any error
 set -e
 
-# Debug script and command lines
-#set -x
-
 # On Buildbot, don't run the mysql-test-run test suite as part of build.
 # It takes a lot of time, and we will do a better test anyway in
 # Buildbot, running the test suite from installed .debs on a clean VM.
@@ -21,29 +17,23 @@ then
   export DEB_BUILD_OPTIONS="nocheck"
 fi
 
-# Don't include test suite package on Travis-CI to make the build time shorter
+# Travis-CI optimizations
 if [[ $TRAVIS ]]
 then
+  # On Travis-CI, the log must stay under 4MB so make the build less verbose
+  sed -i -e '/Add support for verbose builds/,+2d' debian/rules
+
+  # Don't include test suite package on Travis-CI to make the build time shorter
   sed '/Package: mariadb-test-data/,+26d' -i debian/control
   sed '/Package: mariadb-test/,+34d' -i debian/control
 fi
 
-export MARIADB_OPTIONAL_DEBS=""
 
-# Find major.minor version.
-#
-source ./VERSION
-UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
-PATCHLEVEL="+maria"
-LOGSTRING="MariaDB build"
-
-# Look up distro-version specific stuff.
+# Look up distro-version specific stuff
 # Always keep the actual packaging as up-to-date as possible following the latest
 # Debian policy and targetting Debian Sid. Then case-by-case run in autobake-deb.sh
 # tests for backwards compatibility and strip away parts on older builders.
 
-CODENAME="$(lsb_release -sc)"
-
 # If libcrack2 (>= 2.9.0) is not available (before Debian Jessie and Ubuntu Trusty)
 # clean away the cracklib stanzas so the package can build without them.
 if ! apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1
@@ -74,30 +64,25 @@ then
   sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.2.install
 fi
 
-# On Travis-CI, the log must stay under 4MB so make the build less verbose
-if [[ $TRAVIS ]]
-then
-  sed -i -e '/Add support for verbose builds/,+2d' debian/rules
-fi
-
-
-# Adjust changelog, add new version.
-#
+# Adjust changelog, add new version
 echo "Incrementing changelog and starting build scripts"
 
+# Find major.minor version
+source ./VERSION
+UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
+PATCHLEVEL="+maria"
+LOGSTRING="MariaDB build"
+CODENAME="$(lsb_release -sc)"
+
 dch -b -D ${CODENAME} -v "${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automatic build with ${LOGSTRING}."
 
 echo "Creating package version ${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... "
 
-# Build the package.
+# Build the package
 # Pass -I so that .git and other unnecessary temporary and source control files
-# will be ignored by dpkg-source when createing the tar.gz source package
+# will be ignored by dpkg-source when creating the tar.gz source package.
 # Use -b to build binary only packages as there is no need to waste time on
 # generating the source package.
 fakeroot dpkg-buildpackage -us -uc -I -b
 
-[ -e debian/autorm-file ] && rm -vf `cat debian/autorm-file`
-
 echo "Build complete"
-
-# end of autobake script