WIP refactor python