Cleaned up the merge of the APPLE patch