simplifed the if n > 3 sequence