Fixes and add command line tool.