refactor the code structure in __init__.py