Noted that the script works with Ubuntu 14.04.
Split expressions over multiple lines and tidied up logging statements.