Major refactor; put common functions in srpy_common for importing to user code to avoid namespace reference problems with exceptions, etc.