Implement SR.scan (currently segfaults somewhere in the C bindings)