generalized distillate class and added test-algorithm scale.py
merged with master