Added controller attach function to allow nested controllers