- some code clean up and added some comments