Optimized reference counting for structs of simple types.
Remove debug code.
Merge branch 'dev' into new-priorities