updated inArray code