This should be ripped out into a separate helper method.