Updated getText() method