modified to tidy up code
modified a little
add test codes
fixed test codes and remove unused files