Address come comments.

Add more comments, improved the compliance to the Google C++ style guide, and
added more CHECKs, for safety.
Merge branch 'util_task_initial' into integration