refactoring dddom.py and testing new library threepy.py