Updated lib and command line applcation.

Please merge.