Refactoring to enable improvements to the wrapper and to be able to upload it to the Python repository.