basic work now!(passed few cases and add some debug utility to cmd)