Changes to SII module: Bug fixes, refactoring