We probably want to re-do this PR with memoryviews.