refactor and add setup.py