Google style initial check with cpplint.
Fix Coverity reported issues with exceptions.
Refactoring and tests for the input validation.
Documentation update.