Porting to Python. Implemented basic structure.