refactor the __str__ method