Add attach function.