revise the code according to the onsite data