                 var scrollView = object as? UIScrollView
                 if (scrollView != nil) {
                     println(scrollView?.contentOffset.y)
-                    if (scrollView?.contentOffset.y <= -50) {
+                    if (previousOffset < -pullToRefreshDefaultHeight) {
                         label.text = "release to refresh"
                         if (scrollView?.dragging == false && loading == false) {
                             loading = true

        var insets = scrollView.contentInset
        
        // we need to restore previous offset because we will animate scroll view insets and regular scroll view animating is not applied then
        scrollView.contentOffset.y = previousOffset!
        scrollView.bounces = false
        UIView.animateWithDuration(0.3, delay: 0, options:nil, animations: {
            scrollView.contentInset = UIEdgeInsets(top: 50, left: insets.left, bottom: insets.bottom, right: insets.right)

                    } else {
                        label.text = "pull to refresh"
                    }
                    previousOffset = scrollView!.contentOffset.y
                }
            }
        } else {
