Why did military use barracks?