Tweaked javascript