scaling algorithms debugged, working