Removed unused code.
Added some test for cmd.