running in the chat program
merging the optimized version