Minor Code Refactoring and Documentation