single-thread version