Refactor Task API.