more reorg of task code to use task::pimpl