Re-work taskqueue logic and make a set of reusable classes.