Move tidying up command output into command and out of mapper