Working on modularized scan/read code