Modified tostring logic