refactored identifyLine() method