Based on Bad Behavior from http://bad-behavior.ioerror.us/ rebuild for full integration into Magento 1.4 and up