Removed unnecessary copy/release (variable gets copied across block boundaries)
Properly set metadata and release memory