Made scalebar type configurable and some fixes