Max Input Length

New Function and BugFix