Update for post-0.5, master branch changes; avoid even more copies in the inner loops
Updated mutability syntax