Bring data scaling together into a single function