I should probably move this logic somewhere else.