Refactored the task history support added by jennever@foursquare.com