Is it necessary to control the actual output here instead of returning an array of location elements?