Recursive method for scan, add console mode