updated handler code