Bug fixes. Reorg for Python packaging.