Clarify code, add comments