Refactor and add `setup.py`