Alleviated the hackeyness of the scanner callback.