Move tasks code to a tasks file