Complete re-write of __init__.py