Changed the arrays to vectors in Scan3 for simplicity