Cleanup of commandline tools

This reduces the number of lines by 100 and does cleans ups.

TBR=sgjesse@google.com

Review URL: https://codereview.chromium.org//398373002