scale function now works 100% correctly