modified the approach as per documentation