Moving code from wed_modular.py to wed.py and some utility functions