Sync with nathan's code with conflicts