Adding code comments and a bit of refactoring

Practice what you preach, brother!