Improve the displayName() function to be able to handle more edge-cases