Replaced gsub with slice