Some code clean up and commenting.