- further implementation for DIGILIB
- cleaned up scaling function