moved code outside init.py
refactor