Attempt at implementing scan. Somehow not returning an array, unsure why.