[modification] Adding comments and tidy up the codes