Reorganize into a python module