Incorporated runrevmark's feedback on memory ownership (take two)