how were monasteries built