Fix compilation errors and add comments.
Add Pair to util.