Added length restricting logic