Changed some comments
Refractor variables
fix some bugs