updated inArray logic