Hold onto Output's and Input's using unique_ptrs.
Remove comparisons of int to NULL.

Fixes clang warnings introduced by the use of ReferencePtr.