Move main logic out of __init__.py