1312071704: remove index and related variables
1312071706: change some variable names.
1312071707: fix several functions