updated design and code for scanner