Code to use scaling correctly