Add comments, extract function