THIRD AMENDED AND RESTATED MASTER AGREEMENT by and between