added hook code