Commented and refactored