Also get rid of needed[] array for these functions (cherry picked from commit 29bbc9dd) Change-Id: Id208621f66afa2e02a6b3facacee7d874466d81b