working on a efficient string permitation loop