Moved attach() into functiontools.