optimize scanner, parser use callback