Firefighters contain fire that threatened 30 homes