the first version without thread.