Removing poorly listed substr length and introduced inversion instead