Add support for before_throttle callback
Rebased on master