finish the first version, need to debug