improved the 'parseTails()' procedure