refactored getStringRepresentation