Restore prototypes.
More changes to the attach function.