            current-page (:current-page @state)
            num-total (:num-rows props)
            num-pages (js/Math.ceil (/ num-total rows-per-page))
-           num-onClick (fn [n] (fn [e] (swap! state assoc :current-page n)))
-           first-page-box (max 1 (- current-page 4))
-           last-page-box (min num-pages (+ current-page 4))
+           num-onClick (fn [n] #(swap! state assoc :current-page n))
+           page-range (create-page-range current-page num-pages)
            allow-prev (> current-page 1)
            allow-next (< current-page num-pages)
            right-num (min num-total (* current-page rows-per-page))
            left-num (if (zero? right-num) 0 (inc (* (dec current-page) rows-per-page)))]
        [:div {:style {:border "1px solid #ebebeb" :boxShadow "-3px -6px 23px -7px #ebebeb inset"}}
-        [:div {:style {:display "block" :fontSize 13 :lineHeight 1.5
-                       :padding "0px 48px" :verticalAlign "middle"}}
+        [:div {:style {:fontSize 13 :lineHeight 1.5 :padding "0px 48px" :verticalAlign "middle"}}
 
          [:div {:style {:float "left" :display "inline-block" :width "33.33%" :padding "2.15em 0em" :verticalAlign "middle"}}
           [:b {} (str left-num " - " right-num)] (str " of " (pluralize num-total " result"))]

                                    :cursor (when-not selected? "pointer")}
                            :onClick (when-not selected? (num-onClick n))}
                      n]))
              (range first-page-box (+ 1 last-page-box)))]

           [:div {:style {:display "inline-block" :padding "0.55em 0.9em"
                          :color (if allow-next (:button-blue style/colors) (:border-gray style/colors))

        [:div {:style {:overflowX "auto"}}
         [:div {:style {:position "relative"
                        :minWidth (reduce + (:column-widths @state))
                        :cursor (when (:dragging? @state) "col-resize")}
                :onMouseMove (fn [e]
                               (when (:dragging? @state)
                                 (let [widths (:column-widths @state)
