No functional changes. This commit simplifies the recursive call, removes unneeded function calls, and adds comments.