Added revised rescaler code