revised with new array mapping and selection