Added INPUT_MAX.
Made big changes at the cli and cliserver