scanner and callbacks implementation.