We pass everything by reference to avoid memory being unexpectedly free'd from the WASM side. However, neither &Option<> nor Option<&> works with wasm-bindgen at the moment, and therefore optional arguments end up freeing whatever is passed in.
We need to either add this feature to wasm-bindgen or make a wrapper for an optional reference.