Scanner clearing was being done at the wrong point.