function update_boundaryBox(&$boundaryBox, $coords) {
      $width      = $boundaryBox['width'];
      $height     = $boundaryBox['height'];
      $x          = $coords['x'];
      $y          = $coords['y'];
      $reference  = $coords['reference'];
      switch ($reference) {
        case 'top-left':
        case 'left-top':
          $top    = $y;
          $bottom = $y + $height;
          $left   = $x;
          $right  = $x + $width;
          break;
        case 'left-center':
          $top    = $y - ($height / 2);
          $bottom = $y + ($height / 2);
          $left   = $x;
          $right  = $x + $width;
          break;
        case 'left-bottom':
          $top    = $y - $height;
          $bottom = $y;
          $left   = $x;
          $right  = $x + $width;
          break;
        case 'top-center':
          $top    = $y;
          $bottom = $y + $height;
          $left   = $x - ($width / 2);
          $right  = $x + ($width / 2);
          break;
        case 'right-top':
        case 'top-right':
          $top    = $y;
          $bottom = $y + $height;
          $left   = $x - $width;
          $right  = $x;
          break;
        case 'right-center':
          $top    = $y - ($height / 2);
          $bottom = $y + ($height / 2);
          $left   = $x - $width;
          $right  = $x;
          break;
        case 'bottom=right':
        case 'right-bottom':
          $top    = $y - $height;
          $bottom = $y;
          $left   = $x - $width;
          $right  = $x;
          break;
        default:
          $top    = 0;
          $bottom = $height;
          $left   = 0;
          $right  = $width;
          break;
      }

      $boundaryBox = array_merge($boundaryBox, array('top'       => $top,
                                                     'bottom'    => $bottom,
                                                     'left'      => $left,
                                                     'right'     => $right,
                                                     'x'         => $x,
                                                     'y'         => $y,
                                                     'reference' => $reference));
    }