Move the task handlers from the kernel into main