add scan_keys implementation, add profiling