Added the shorten method and tests