I think we should try to move this logic into setContents.