modify this code, don't use insert function.