appendSelection was splitted and simplified