Update over maxlength functionality

Update over maxlength functionality and add unit tests.