refactor as python package