remove unnecessary dependences
Clean up the code

Prevent pollution to global namespace, review dependences, correct
typo, add comments