Convert some loops to lambdas. Add some workaround to detect if the
instruction related to some kernel services