improve performance of scanner