moving attachToAdjacent method to onDetach()