further string-extraction and refactoring until line 2242