* input: fixed buffer overflow, add sanity check and big big clean up.