Added extra sanity checking to Dan's new code
New scalebar.