Bug fixes and add Cmd library