Updated code to use new modal API