(Modified by Philip Withnall <withnall@endlessm.com> to improve formatting on original.) Closes #1363