achieve function to buy, check,merge and need to test