Added attach function