-scale_range = ({frame, factor, center, h_axis_only = false, v_axis_only = false}) ->
-  # Util for Tools to Scale ranges of a frame for use by PlotCanvasView.update_range()
-  #
-  # Parameters:
-  # * frame
-  # * factor      - scaling factor (clamped: -0.9 < args.factor < 0.9)
-  # * center      - center point for scaling
-  # * v_axis_only - if true only scale the vertical axis
-  # * h_axis_only - if true only scale the horizontal axis
+# Module for zoom-related functions
+
+scale_range = (frame, factor, h_axis=true, v_axis=true, center=null) ->
+  """
+  Utility function for zoom tools to calculate/create the zoom_info object
+  of the form required by ``PlotCanvasView.update_range``
+
+  Parameters:
+    frame : CartesianFrame
+    factor : Number
+    center : object, optional
+      of form {'x': Number, 'y', Number}
+    h_axis : Boolean, optional
+      whether to zoom the horizontal axis (default = true)
+    v_axis : Boolean, optional
+      whether to zoom the horizontal axis (default = true)
+
+  Returns:
+    object:
+  """
 
   hr = frame.h_range
   vr = frame.v_range

  else if factor < -0.9
    factor = -0.9

  vx_low  = hr.start
  vx_high = hr.end

  vy_low  = vr.start
  vy_high = vr.end

  frame_center = {
    x: (vx_high + vx_low) / 2.0
    y: (vy_high + vy_low) / 2.0
  }

  # if center or either dimension center.x,y
  # isn't given, use the frame_center
  vx = center?.x ? frame_center.x
  vy = center?.y ? frame_center.y

  if vx < vx_low or vx > vx_high
    v_axis_only = true
  if vy < vy_low or vy > vy_high
    h_axis_only = true

  if not v_axis_only
    sx0 = vx_low  - (vx_low  - vx)*factor
    sx1 = vx_high - (vx_high - vx)*factor
  else
    sx0 = vx_low
    sx1 = vx_high

  if not h_axis_only
    sy0 = vy_low  - (vy_low  - vy)*factor
    sy1 = vy_high - (vy_high - vy)*factor
  else


  xrs = {}
  for name, mapper of frame.x_mappers
    [start, end] = mapper.v_map_from_target([sx0, sx1])
    xrs[name] = {start: start, end: end}

  yrs = {}
  for name, mapper of frame.y_mappers
    [start, end] = mapper.v_map_from_target([sy0, sy1])
    yrs[name] = {start: start, end: end}

  # OK this sucks we can't set factor independently in each direction. It is used
