test first version of retain selection algo

Current implementation fails to select the correct substring. Needs a new algorithm.