Enclosed js methods, added visual scale, tooltips now flip if they hit the bottom, js refactoring