Some code clean up for better readability and more explanatory comments