Attempted a manual merge of Alex's new cuda