trying to fix repeated output