compelete the temp version but too slow

have to reduce the replication computation