implemented better length definition.