Removed shared_ptr from contract method, replaced with class optional_ptr which combines functionality of raw pointer and unique_ptr depending on how it is initialized.