arrange code and add comments for #25