made bar script more useful to other stuff