Complete re-write of __init__.py
Merge branch 'rewrite'