Added comments for readability and debugging.