move main to __init__