Some refactoring to unbreak setup.py